//
//  PlcPlayerViewController.m
//  PLRLiveShow
//
//  Created by 赵小燕 on 2017/8/6.
//  Copyright © 2017年 xiaoyanzhao. All rights reserved.
//

#import "PlcPlayerViewController.h"
#import "PlcRoomInfo.h"
#import "PlayerView.h"

static NSString * const kHost = @"http://192.168.1.200:8080/hls/test1.m3u8";

@interface PlcPlayerViewController ()

@property (nonatomic, strong) PlcRoomInfo *roomInfo;
@property (nonatomic, strong) PlayerView *playerView;

@end

@implementation PlcPlayerViewController

- (instancetype)initWithRoomInfo:(PlcRoomInfo *)roomInfo {
    self = [super init];
    if (self) {
        _roomInfo = roomInfo;
    }
    return self;
}

- (void)viewDidLoad {
    [super viewDidLoad];
    NSURL *url = [NSURL URLWithString:_roomInfo.playURL];
    self.playerView = [[PlayerView alloc] initWithUrl:url];
    [self.view addSubview:self.playerView];
    [self.playerView play];
}

- (void)viewDidDisappear:(BOOL)animated {
    [super viewDidDisappear:animated];
    [self.playerView stop];
}

@end
